package cn.dengta.webapp.base.entity;

import cn.dengta.common.model.ValueProxy;
import cn.dengta.common.model.ValueProxyImpl;
import lombok.Getter;

@Getter
public enum ChannelAppType implements ValueProxyImpl<ChannelAppType, String> {

	/** main */
	AD("Adjust"),
	/** googleLite */
	AF("AppsFlyer"),
	/** 内部广告系统 */
	INTER_AD("广告系统"),
	//
	;

	// 定义私有变量
	boolean enabled;
	final ValueProxy<ChannelAppType, String> proxy;

	// 构造函数，枚举类型只能为私有
	ChannelAppType(String label, boolean enabled) {
		this.enabled = enabled;
		this.proxy = new ValueProxy<>(this, name(), label);
	}

	ChannelAppType(String label) {
		this(label, true);
	}

	public static ChannelAppType[] getValues() {
		return ValueProxy.getCachedArray(ChannelAppType.class, ChannelAppType::values);
	}

	public static ChannelAppType of(String value) {
		return AD.getValueOf(value);
	}

	public static ChannelAppType ofOrDefault(String value) {
		ChannelAppType channel = of(value);
		return channel == null ? AD : channel;
	}

}
